package com.aikon.wht.designPattern.async;

import java.util.concurrent.Callable;

/**
 * @author haitao.wang
 */
public class TestOfAsync {

    public static void main(String[] args) throws InterruptedException {
        AsyncExecutor executor = new DefaultAsyncExecutor();
        AsyncResult<String> asyncResult = executor.process(produceCallable());
        System.out.println("vvv"+asyncResult.getVal());
        String val = executor.endProcess(asyncResult);
        System.out.println("nnn"+val);
    }

    public static Callable<String> produceCallable() {
        return () -> {
            System.out.println("aaa");
            return "bbb";
        };
    }
}
